home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-08-31 | 1.7 KB | 56 lines | [TEXT/ttxt] |
- \ VScroll - Control subclass for vertical scroll bars
- \ 12/17/84 cbd Version 1
- \ 12/26/85 cdn Added clear: parts to actions:
- \ 1/31/86 rfl added last line oin new: to make consistent with ctl.rfl
- Decimal
-
- \ myCtl returns the address of the owning control for a control
- \ action handler. It is the second object down on the mstack.
- 'c mp0 vect myCtl
-
- :CLASS vScroll <Super Control
-
- 5 Ordered-Col Parts
- 5 X-Array Actions
-
- \ load the actions for the parts of the scroll bar
- \ ( up dn pgUp pgDn thumb -- )
- :M ACTIONS: put: actions clear: parts
- 129 23 22 21 20 5 0 DO add: parts LOOP ;M
-
- \ ( part# -- ) perform action for part no.
- :M EXEC: indexOf: parts
- IF exec: actions THEN ;M
-
- :M NEW: { left top len wind -- }
- left top left 16 + top len +
- Put: tempRect 0 abs: Wind Abs: tempRect nullosstr
- w 256 word0 word0 w 1 w 16 ^base
- call NewControl put: ctlhndl
- ^base get: ctlhndl set-ctl-obj
- wind put: myWindow ;M \ don't put self until setRange is called
-
- \ ( -- ) set the control to 255 hiliting (disabled)
- :M DISABLE: 255 hilite: super ;M
-
- \ ( -- ) set all parts to enabled hiliting.
- :M ENABLE: 5 2 DO I at: parts hilite: self LOOP ;M
-
- :M CLASSINIT: 16 put: procID <[ 5 ]> 'cfas null null null null null
- actions: self ;M
-
- \ set the maximum and minimum values of the thumb
- :M PUTRANGE: { lo hi -- } get: ctlHndl lo makeInt call SetMinCtl
- get: ctlHndl hi makeInt call SetMaxCtl ;M
-
- \ ( -- ) show an example vertical scroll bar
- :M EXAMPLE: { theWind -- } 100 50 80 theWind
- new: self show: self 1 10 putRange: self ;M
-
- ;CLASS
-
- \ define some typical handlers
- \ : lnUp get: myCtl 1- 0 max put: myCtl ;
- \ : lnDn get: myCtl 1+ put: myCtl ;
-
-